#define CLUSTER_LIBRE 0x00000000
#define CLUSTER_RESERVADO 0x00000001
#define CLUSTER_RESERVADO2 0x0FFFFFF6
#define CLUSTER_CORRUPTO 0x0FFFFFF7
#define CLUSTER_OCUPADO 0x0FFFFFF8

struct boot_sector_values
	{
	unsigned char value_jump_instruction[3] ;
	unsigned char value_oem_name[8];
	unsigned short value_bytes_per_sector;
	unsigned char value_sector_per_cluster;
	unsigned short value_reserved_sector_count;
	unsigned char value_number_of_fats;
	unsigned short value_number_of_root_dirs;
	unsigned short value_total_sectors;
	unsigned char value_media_descriptor;
	unsigned short value_sectors_per_fat;
	unsigned short value_sectors_per_track;
	unsigned short value_number_of_heads;
	unsigned int value_hidden_sectors_for_partition;
	unsigned int value_total_sectors_greater;
	unsigned int value_sectors_per_fat_table;
	unsigned short value_fat_flags;
	unsigned short value_version;
	unsigned int value_cluster_number_root_start;
	unsigned short value_sector_fs_information;
	unsigned short value_sector_of_boot_copy;
	unsigned char value_reserved[12];
	unsigned char value_physical_drive_number;
	unsigned char value_reserved1;
	unsigned char value_extended_boot_signature;
	unsigned int value_id;
	unsigned char value_label[11];
	double value_fat_type;
	unsigned char value_OS_boot_code[420];
	unsigned short value_boot_sector_signature;
	} __attribute__ ((__packed__));

struct boot_sector_char
		{
		unsigned char jump_instruction[3] ;
		unsigned char oem_name[8];
		unsigned char bytes_per_sector[2];
		unsigned char sector_per_cluster[1];
		unsigned char reserved_sector_count[2];
		unsigned char number_of_fats[1];
		unsigned char number_of_root_dirs[2];
		unsigned char total_sectors[2];
		unsigned char media_descriptor[1];
		unsigned char sectors_per_fat[2];
		unsigned char sectors_per_track[2];
		unsigned char number_of_heads[2];
		unsigned char hidden_sectors_for_partition[4];
		unsigned char total_sectors_greater[4];
		unsigned char sectors_per_fat_table[4];
		unsigned char fat_flags[2];
		unsigned char version[2];
		unsigned char cluster_number_root_start[4];
		unsigned char sector_fs_information[2];
		unsigned char sector_of_boot_copy[2];
		unsigned char reserved[12];
		unsigned char physical_drive_number[1];
		unsigned char reserved1[1];
		unsigned char extended_boot_signature[1];
		unsigned char id[4];
		unsigned char label[11];
		unsigned char fat_type[8];
		unsigned char OS_boot_code[420];
		unsigned char boot_sector_signature[2];
		} __attribute__ ((__packed__));

union boot_sector
{
	struct boot_sector_char caracteres;
	struct boot_sector_values valores;
};

struct FS_information_sector_char
{
	unsigned char FS_infrmation_signature[4];
	unsigned char reserverd[480];
	unsigned char FS_infrmation_signature2[4];
	unsigned char free_clusters[4];
	unsigned char ultimo_cluster_acedido[4];
	unsigned char reserved2[12];
	unsigned char FS_infrmation_signature3[4];
} __attribute__ ((__packed__));
struct FS_information_sector_values
{
	unsigned char FS_infrmation_signature[4];
	unsigned char reserverd[480];
	unsigned char FS_infrmation_signature2[4];
	unsigned int free_clusters;
	unsigned int ultimo_cluster_acedido;
	unsigned char reserved2[12];
	unsigned char FS_infrmation_signature3[4];
} __attribute__ ((__packed__));

union FS_information_sector
{
	struct FS_information_sector_char caracteres;
	struct FS_information_sector_values valores;
};

//void llenar_boot_sector(char *, char *, unsigned int);
void llenar_desde_cluster(char *, char *, unsigned long long , unsigned long long);
void imprimir_campo(unsigned char * , int );
void byte_a_sector(unsigned long long , unsigned long *, unsigned long *, unsigned long *);
unsigned int * llenar_Tabla_FAT (union boot_sector , FILE *);
unsigned long largo_tabla_tabla_FAT_byte(union boot_sector);
unsigned int largo_tabla_tabla_FAT_entero(union boot_sector);
unsigned int proximo_cluster_en_cadena(const int* , unsigned int );
unsigned long offset_sectores_para_datos(union boot_sector);
void traer_entrada_de_directorio(int *,char * , char * , unsigned int *);
